package org.yang.order.food.controller;

import org.yang.order.food.common.Msg;
import org.yang.order.food.entity.Order;
import org.yang.order.food.service.OrderService;
import org.springframework.web.bind.annotation.*;

import com.github.pagehelper.PageInfo;

import javax.annotation.Resource;
/**
 * 订单控制器
 * @author shichenyang
 * @email gyv12345@163.com
 * @date 2018/12/03
 */
@RestController
@RequestMapping("/order")
public class OrderController {
    @Resource
    private OrderService orderService;

    @GetMapping("/getOrders")
    public PageInfo getOrders(Order order,Integer page,Integer limit){
        return orderService.getOrders(order,page,limit);
    }
    @PostMapping("/addOrder")
    public Msg addOrder(Order order){
        return orderService.addOrder(order);
    }

    @PutMapping("/updateOrder")
    public Msg updateOrder(Order order){
        return orderService.updateOrder(order);
    }

    @DeleteMapping("/delOrder")
    public Msg delOrder(Order order){
        return orderService.delOrder(order);
    }
}
